package com.ctbri.concurrency;

public class Ex1 implements Runnable{
	
	private final int id;
	public Ex1(int id) {
		this.id = id;
		System.out.println("Ex1 #" + id + " consturcting");
	}
	public void run() {
		for(int i = 0; i < 3; i++) {
			System.out.println("Ex1 #" + id + " computing " + i);
			Thread.yield();
		}
		System.out.println("Ex1 #" + id + " finish");
	}

	public static void main(String[] args) {
		for(int i = 0; i < 100; i++) {
			Ex1 ex = new Ex1(i);
			ex.run();
		}
	}

}
